<script type="text/javascript">
    $(function(){    
    });
    
    function loadPage(pageNumber) {
        $.getJSON("http://localhost/PersonalTask/public/Activity/pageService/",
        {
            page: pageNumber
        },
        function(data) {
            $.each(data.activities, function(i,item){
                $("#activitiesContent").append(
                    "<tr><td>" + item.name + "</td><td>" + item.description + "</td><td>" + item.planned_time + "</td><tr>"
                );
            });
        });
    }
    
</script>

<br>
<a class="btn btn-primary btn-large" href="<?= $this->url(array("controller" => "Activity", "action" => "save")) ?>">
    Crear Actividad
</a>
<br><br><br>

<div style="height: 385px;">

<!--<div id="demo" class="collapse in"> … </div>-->
    <table class="table table-bordered table-striped">
        <thead>
            <tr>
                <th>Nombre</th>
                <th>Descripcion</th>
                <th>Tiempo Estimado</th>
                <th>Opciones</th>
            </tr>
        </thead>
        <tbody id="activitiesContent">
            <?php foreach ($this->paginator as $activity) : ?>
            
                <tr>
                    <td><?= $activity["name"] ?></td>
                    <td><?= $activity["description"] ?></td>
                    <td><?= $activity["planned_time"] ?></td>
                    <td><a href="<?= $this->url(array("controller" => "Activity", "action" => "monitor", "id" => $activity["idactivities"])) ?>">Ver Tareas</a></td>
                </tr>
            
                
            <?php endforeach; ?>
        </tbody>
        
    </table>
</div>

<?php echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml'); ?>
